import React from 'react'
import './index.less'
import CommonHeader from 'COMPONENT/CommonHeader';
import SmsPassword from 'COMPONENT/SmsPassword';
import TransactionPassword from 'COMPONENT/TransactionPassword';
import { Button, WhiteSpace } from 'antd-mobile';
import PropTypes from 'prop-types';

const initData = { 
    month:'24',//贷款月份
    rate:'0.023',//贷款利率
    dueDate:'每月1日',//还款日
    cardCode:'62262****5118',//贷款/还款卡号
    money:'3,000.00',//贷款金额

}

class HmdMain extends React.Component { 
    static contextTypes = {
        router: PropTypes.object.isRequired
    }
    constructor(props){ 
        super(props);
        this.state={ 
        	isMsgShow:'none',
        	isPwdShow:'none',
            hmdData:{ 
                month:'24',//贷款月份
                rate:'0.023',//贷款利率
                dueDate:'每月1日',//还款日
                cardCode:'62262****5118',//贷款/还款卡号
                money:'3,000.00',//贷款金额
            }
        }
    }
    btnClick=()=>{ 
        //跳转
        // this.context.router.push({
		// 	pathname: '/HmdMain/HmdCTAffirm'
        // })l
        this.setState({
        	isMsgShow:'block'
        })
    }
    componentDidMount(){ 
        // let data = JSON.parse(localStorage.getItem('hmdData')) || initData;
        // this.setState({ 
        //     hmdData:data,
        // })
    }
    
    closeMsgComponent = () => {
    	this.setState({
        	isMsgShow:'none',
        	isPwdShow:'block'
        	
        })
    };
    // 获取验证码
    sendCodeFun = () => {
        console.log('获取验证码:sendCodeFun....');
    };
    

    
    closePwdComponent = () => {
    	this.setState({
        	isMsgShow:'none',
        	isPwdShow:'none'
        })
      	 this.context.router.push({
		 	pathname: '/HmdMain/HmdMainApplyRes'
        })
    }
    

    render() {
        let info = this.state.hmdData;

        return (
            <div className="hmd_affirm">
           		<CommonHeader 
					name='确认信息'					
					leftContentTitle="@back" 
					leftContent='返回'
				/>
				<div style={{height:'.9rem'}}></div>

                 <div className="hmd_affirm_top">
                    <div>您正在申请信用贷</div>
                    <div>申请金额<span>{info.money}</span>元,限期{info.month}个月</div>
                </div>
                <div className="hmd_affirm_info"> 
                    <div>
                        <span>还款方式</span><span>等息本额</span>
                    </div>
                    <div>
                        <span>日利率</span><span>{info.rate}%</span>
                    </div>
                    <div>
                        <span>还款日</span><span>{info.dueDate}</span>
                    </div>
                    <div>
                        <span>放款/还款卡号</span><span>{info.cardCode}</span>
                    </div>
                </div>
                {/*<div className="hmd_affirm_btn">*/}
                    {/*<Button type="primary" inline className="form_btn" onClick={this.btnClick}>确认提交</Button>*/}
                {/*</div>*/}
                <WhiteSpace size="lg" />
                <div className="btnGroup-one">
                    <Button type="primary" className="btnGroup-one-btn"
                            onClick={this.btnClick}>确认提交</Button>
                </div>
				<SmsPassword title="验证短信密码" phone="159****9807" isShow={this.state.isMsgShow}
                             nextAction={this.closeMsgComponent}
                             getCodeFun={this.sendCodeFun}
                />
				<TransactionPassword title="验证交易密码" isShow={this.state.isPwdShow}  nextAction={this.closePwdComponent}/>
            </div>
        );
    }
}
export default HmdMain;